<?php

include('config.php');
include('common-functions.php');

// Test if exits blank variables, and dont allow pass.  
if(($_POST['name'] != "") && ($_POST['nameEmail']!= "") && ($_POST['pass']!= "") && ($_POST['pass2']!= ""))
{ 

		// Clean Input
		$name		=	cleanInput($_POST['name']);
		$email		=	cleanInput($_POST['nameEmail']);
		$psw		=	cleanInput($_POST['pass']);
		$psw2       =   cleanInput($_POST['pass2']);
		
		// Verify login
		$login_sql	=	'SELECT * FROM tbUSERS WHERE Email ="'.$email.'"';
		$login		=	mysql_query($login_sql);
				
		if(mysql_num_rows($login)>0)
		{
			echo $ciao;
			redirect('../index.php?error=1');
			
		}
		else
		{			
			
			$signup_sql	    =	'INSERT INTO tbUSERS (Name, Email, Password, fkType, Pagination) 
			                     VALUES (  "'.$name.'" , "'.$email.'", "'.$psw.'", "1", "15")';
			$signup_result	=	mysql_query($signup_sql);
			
			redirect('../index.php?login=ok');
			
		} 
}
else
{
	redirect('../index.php?error=1');
}

?>